<template>
  <div id="app">
   <button @click="getStudents">点击我获取学生数据信息</button>
   <button @click="getCars">点击我获取车的数据信息</button>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "App",

   data(){
    return {
    
    }
  },
  methods:{
    //获取学生信息
    getStudents(){
      axios.get('http://localhost:8080/api/students').then(
        response => {
          console.log('数据获取成功了',response.data)
        },
        error => {
          console.log('数据获取失败了',error.message)
        }
      )
    },
    //获取车的数据信息
    getCars(){
         axios.get('http://localhost:8080/getCars/cars').then(
        response => {
          console.log('数据获取成功了',response.data)
        },
        error => {
          console.log('数据获取失败了',error.message)
        }
      )
    }
   
  
  },

};
</script>

